<?php
require_once dirname(__FILE__).'/../../rightMenuWidget/lib/RightMenuHelper.class.php';

class RightMenuArchiveHelper extends RightMenuHelper{

	// constraints for past events
	public function setConstraintsOnEvents($q,$node){
		$q->andWhere($q->getRootAlias().'.id = ?', $node['id']);
			if($q->hasAliasDeclaration('p')){
				$q->orderBy('p.scheduled desc')
					->innerJoin('p.ProductPictures pp WITH pp.parameter = ?', 'cover')
					->innerJoin('p.Translation t WITH t.lang = ?', $this->getAction()->getUser()->getCulture())
					->addSelect('t.*')
					->addSelect('pp.*')
					->andWhere('p.scheduled < NOW()');
			}

		return $q;
	}

}